package com.raquel.coffeeland;

import android.os.Bundle;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MenuActivity extends ListActivity {
	
	private String[] menu={"Info", "About", "Get", "Post", "Game"};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//setContentView(R.layout.activity_menu);
		
		setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, menu));
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.menu, menu);
		return true;
	}
	
	protected void onListItemClick(ListView list, View view, int position, long id){
		super.onListItemClick(list, view, position, id);
		
		String textName = menu[position];
		
		try{
			Class clase = Class.forName("com.raquel.coffeeland."+textName+"Activity");
			Intent intent= new Intent(this,clase);
			startActivity(intent);
			
		}catch(ClassNotFoundException e){
			e.printStackTrace();
		}
	}

}
